<% add_decidim_meta_tags(
  description: translated_attribute(current_participatory_space.short_description),
  title: t("decidim.components.pagination.page_title",
           component_name: component_name,
           current_page: @proposals.current_page,
           total_pages: @proposals.total_pages ),
  url: proposals_url,
  resource: current_component) %>

<% append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
<% append_javascript_pack_tag "decidim_proposals" %>

<% content_for :aside do %>
  <h1 id="proposals-count" class="title-decorator"><%= component_name %></h1>

  <div class="proposal-list__aside__button-container">
    <% if current_settings.creation_enabled && current_component.participatory_space.can_participate?(current_user) %>
      <%= action_authorized_link_to :create, new_proposal_path, permissions_holder: current_component, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_proposal_path } do %>
        <span><%= t("new_proposal", scope: "decidim.proposals.proposals.index") %></span>
        <%= icon "add-line" %>
      <% end %>
    <% end %>

    <% if component_settings.collaborative_drafts_enabled? %>
      <%= link_to collaborative_drafts_path, class: "button button__sm button__transparent-secondary" do %>
        <span><%= t("collaborative_drafts_list", scope: "decidim.proposals.proposals.index") %></span>
        <%= icon "edit-2-line" %>
      <% end %>
    <% end %>
  </div>

  <%= render layout: "decidim/shared/filters", locals: { filter_sections: , search_variable: :search_text_cont, skip_to_id: "proposals" } do %>
    <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
  <% end %>
<% end %>

<%= render layout: "layouts/decidim/shared/layout_two_col" do %>

  <% if Decidim::Map.available?(:geocoding, :dynamic) && component_settings.geocoding_enabled? %>
    <div class="proposal-list__map">
      <%= cell "decidim/map", @proposals, metadata_card: "decidim/proposals/proposal_metadata" %>
    </div>
  <% end %>

  <%= render partial: "decidim/shared/component_announcement" %>
  <%= render partial: "voting_rules" %>

  <section id="proposals" class="layout-main__section layout-main__heading">
    <%= render partial: "proposals" %>
  </section>

<% end %>
